package com.kefu.call.vo;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.call.model.ContactPlan;
import cn.hutool.core.util.IdUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author francis
 * @date 2021/05/22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "联系计划")
public class ContactPlanInsertVo extends AbstractInsertVo<ContactPlan> {
    /**
     * 计划名称
     */
    @Size(max = 32,min=1)
    @ApiModelProperty(name = "planName", value = "计划名称")
    private String planName;

    /**
     * 计划开始时间
     */
    @NotNull(message = "预约时间不能为空")
    @ApiModelProperty(name = "subscribeTime", value = "预约时间")
    private Long subscribeTime;

    /**
     * 提醒分钟数
     */
    @NotNull(message = "处理时间不能为空")
    @ApiModelProperty(name = "reserveTime", value = "提醒分钟数", allowableValues = "5,10,15,60")
    private Integer reserveTime;

    /**
     * 计划类型
     */
    @ApiModelProperty(name = "planType", value = "计划类型",example="1",notes="1=自定义联系计划，2=在线客户留言，3=呼叫留言")
    private Integer planType = 2;

    /**
     * 客户ID
     */
    @ApiModelProperty(name = "customerId", value = "客户ID")
    private String customerId;

    /**
     * 客户名称
     */
    @ApiModelProperty(name = "customerName", value = "客户名称")
    private String customerName;

    /**
     * 客户号码
     */
    @ApiModelProperty(name = "customerPhone", value = "客户号码")
    private String customerPhone;

    /**
     * 计划备注
     */
    @ApiModelProperty(name = "planDesp", value = "计划备注")
    private String planDesp;

    @Override
    public ContactPlan convert() {
        ContactPlan info = BeanUtil.toBean(this, ContactPlan.class);
        info.setPlanType(1);
        info.setDataStatus(1);
        info.setPlanStatus(1);
        info.setTenantId(KefuContext.getTid());
        info.setPlanId(IdUtil.simpleUUID());
        info.setCreateTime(DateUtil.current());
        info.setCreateUser(KefuContext.getUid());
	    return info;
	}
}